﻿package 
{
	import org.osflash.thunderbolt.Logger;

	public class Embeds
	{
		//embed assets
		[Embed(source='../bin/game/club.jpg')]
		public var game_club_jpg:Class;

		[Embed(source='../bin/game/lecturehall.jpg')]
		public var game_lecturehall_jpg:Class;

		[Embed(source='../bin/game/meadow.jpg')]
		public var game_meadow_jpg:Class;
		
		[Embed(source='../bin/game/menu.jpg')]
		public var game_menu_jpg:Class;

		[Embed(source='../bin/game/options.rpy', mimeType='application/octet-stream')]
		public var game_options_rpy:Class;
		
		[Embed(source='../bin/game/script.rpy', mimeType='application/octet-stream')]
		public var game_script_rpy:Class;

		[Embed(source='../bin/game/sylvie_giggle.png')]
		public var game_sylvie_giggle_png:Class;

		[Embed(source='../bin/game/sylvie_normal.png')]
		public var game_sylvie_normal_png:Class;

		[Embed(source='../bin/game/sylvie_smile.png')]
		public var game_sylvie_smile_png:Class;

		[Embed(source='../bin/game/sylvie_surprised.png')]
		public var game_sylvie_surprised_png:Class;
		
		[Embed(source='../bin/game/sylvie2_giggle.png')]
		public var game_sylvie2_giggle_png:Class;

		[Embed(source='../bin/game/sylvie2_normal.png')]
		public var game_sylvie2_normal_png:Class;

		[Embed(source='../bin/game/sylvie2_smile.png')]
		public var game_sylvie2_smile_png:Class;

		[Embed(source='../bin/game/sylvie2_surprised.png')]
		public var game_sylvie2_surprised_png:Class;

		[Embed(source='../bin/game/uni.jpg')]
		public var game_uni_jpg:Class;
		
		public function Embeds():void 
		{
		}
		
		public function getEmbeddedObjectDefinition(pathAndFilename:String):Object
		{
			//replace dot by underscore
			while (pathAndFilename.indexOf(".") != -1)
			{
				pathAndFilename = pathAndFilename.replace(".", "_"); 
			}

			//replace slash by underscore
			while (pathAndFilename.indexOf("/") != -1)
			{
				pathAndFilename = pathAndFilename.replace("/", "_"); 
			}

			//replace backslash by underscore
			while (pathAndFilename.indexOf("/") != -1)
			{
				pathAndFilename = pathAndFilename.replace("\\", "_"); 
			}

			try
			{
				var classNameDef:Object = this[pathAndFilename];
			}
			catch (e:Object)
			{
				Logger.info("Embeds::getEmbeddedObjectDefinition --not embedded:" + pathAndFilename);
			}
			return classNameDef;
		}		

	}
}